package com.kun.enums;

/**
 * 方向
 */
public enum DirectionEnum {
    /** 北 */
    NORTH("N"),

    /** 南 */
    SOUTH("S"),

    /** 西 */
    WEST("W"),

    /** 东 */
    EAST("E");

    private String direction;

    public String getDirection() {
        return direction;
    }

    DirectionEnum(String direction) {
        this.direction = direction;
    }

    /**
     * 获取顺时针的下一个方向
     * @param nowDirection
     * @return
     */
    public static String getNextClockwise(String nowDirection){
        switch (nowDirection){
            case "N":
                return "E";
            case "S":
                return "W";
            case "W":
                return "N";
            case "E":
                return "S";

        }
        throw new RuntimeException("your direction is not valid,please check...");
    }

    /**
     * 获取逆时针的下一个方向
     * @param nowDirection
     * @return
     */
    public static String getNextAntiClockwise(String nowDirection){
        switch (nowDirection){
            case "N":
                return "W";
            case "S":
                return "E";
            case "W":
                return "S";
            case "E":
                return "N";
        }
        throw new RuntimeException("your direction is not valid,please check...");
    }
}
